package com.chicken.util;

import org.springframework.util.Assert;

public class Result {

    private String code;

    private String message;

    private Object data;

    public static Result fail(String message) {
        Result result = new Result();
        result.setMessage(message);
        return result;
    }

    public static Result fail(String code, String message) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        return result;
    }

    public static Result success(String message, Object data) {
        return success("200", message, data);
    }

    public static Result success(Object data) {
        return success("200", "ok", data);
    }

    public static Result success(String message) {
        return success("200", message, null);
    }

    public static Result success(String code, String message, Object data) {
        Result result = new Result();
        result.setCode(code);
        result.setMessage(message);
        result.setData(data);
        return result;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }
}
